# -*-coding:utf-8-*-
# 
import lxml
from bs4 import BeautifulSoup
from xml import etree
import os
from os import path

html_path = [path.join('H:\\ttt\\', i) for i in os.listdir('H:\\ttt')]
#print(html_path[5])

def get_Txt(html):
    with open(html, 'r', encoding='utf-8', errors='ignore') as html_content:
        soup = BeautifulSoup(html_content.read(), 'lxml')
    return soup.get_text()

for i in html_path:
    print(i)
    txt = get_Txt(i)
    path = 'H:\\txt\\' + str(html_path.index(i)+1) + '.txt'
    with open(path, 'w', encoding='utf-8') as f:	
    	f.write(txt)
    
#print(html)

